package com.cango.springboot.controller;

import com.cango.springboot.utils.ShowIp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@RestController
@RequestMapping("/index")
public class RenderController {

    private static final Logger log = LoggerFactory.getLogger(RenderController.class);

    @Value("${application.test}")
    private String message;

    private String sip;

    @RequestMapping("")
    public ModelAndView index() {
        ModelAndView modelAndView = new ModelAndView("index");

        modelAndView.addObject("hello", message);
        ShowIp showip = new ShowIp();
        sip = showip.getMyIp();
        System.out.print(sip);
        modelAndView.addObject("sip",sip);
        return modelAndView;
    }
}
